package com.wan.adapter

import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup
import com.wan.entity.SystemTabSonEntity

class SystemSonVpAdapter(var viewList:ArrayList<View>,var titleList:ArrayList<SystemTabSonEntity>) :PagerAdapter() {
    override fun isViewFromObject(view: View, `object`: Any): Boolean {
        return  view == `object`
    }

    override fun getCount(): Int {
        return viewList.size
    }

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        var view = viewList[position]
        container.addView(view)
        return view
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
        container.removeView(viewList[position])
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return titleList[position].name
    }

}